home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_100 / 187_01 / getdir.c < prev    next >
C/C++ Source or Header  |  1986-02-19  |  1KB  |  33 lines

  1. /*@*****************************************************/
  2. /*@                                                    */
  3. /*@ getdir - get text of current path on given drive.  */
  4. /*@                                                    */
  5. /*@   Usage:     getdir(drive, buffer);                */
  6. /*@         where drive is the drive NUMBER (e.g.      */
  7. /*@                  A: is 1, B: is 2, etc.  0 is the  */
  8. /*@                  default drive.                    */
  9. /*@               buffer receives the path name.       */
  10. /*@                                                    */
  11. /*@       returns the address of buffer.               */
  12. /*@                                                    */
  13. /*@       NOTE: buffer must be at least 64 bytes long. */
  14. /*@                                                    */
  15. /*@*****************************************************/
  16.  
  17. extern unsigned _rax, _rbx, _rcx, _rdx, _rsi, _rdi, _res, _rds;
  18. extern char _carryf, _zerof;
  19.  
  20. char *getdir(drive, buffer)
  21. int drive;
  22. char *buffer;
  23. {
  24.     buffer[0] = 0x00;        /* clear buffer */
  25.     _rax = 0x4700;            /* set current directory DOS function */
  26.     _rdx = drive;            /* drive number */
  27.     _rds = _showds();        /* current DS segment */
  28.     _rsi = &buffer[1];        /* allow for leading \ to be inserted */
  29.     _doint(0x21);            /* call DOS */
  30.     buffer[0] = '\\';
  31.     return buffer;
  32. }
  33.